package com.itheima.search.controller;

import com.itheima.search.service.SearchService;
import entity.Result;
import entity.StatusCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/search")
public class searchController {

   @Autowired
    private SearchService searchService;
   @PostMapping
   public Result<Map> search(@RequestBody Map searchMap) {
       Map resultMap = searchService.search(searchMap);
       return new Result<Map>(true,StatusCode.OK,"查询成功",resultMap);
   }

}
